package com.dubito.pattern.创建型模式.单例模式.懒汉式;

/**
 * @author liliang
 * @date 2020/8/26.
 */
public class GlobalNum {

    private static GlobalNum instance = new GlobalNum();

    private int num = 0;

    public static GlobalNum getInstance() {
        return instance;
    }

    public synchronized int getNum() {
        return ++num;
    }
}
